﻿using System.Windows;
using Peter.Sdw.Data;
using Peter.Sdw.Logic;

namespace Peter.Sdw.View
{
   /// <summary>
   /// Interaction logic for FooterEditView.xaml
   /// </summary>
   public partial class FooterListEditView
   {
      private FooterListModel m_FooterListModel;

      /// <summary>
      /// Initializes a new footer view.
      /// </summary>
      public FooterListEditView ()
      {
         InitializeComponent ();
         this.DataContextChanged += this.OnDataContextChanged;
      }

      /// <summary>
      /// Occurs when the data context changes.
      /// </summary>
      /// <param name="sender">This.</param>
      /// <param name="e">DependencyPropertyChangedEventArgs</param>
      private void OnDataContextChanged (object sender, DependencyPropertyChangedEventArgs e)
      {
         this.DataContextChanged -= this.OnDataContextChanged;
         this.m_FooterListModel = this.DataContext as FooterListModel;
      }

      /// <summary>
      /// Occurs when the selection in the text box changes.
      /// </summary>
      /// <param name="sender">The text box.</param>
      /// <param name="e">RoutedEventArgs</param>
      private void OnTextSelectionChanged (object sender, RoutedEventArgs e)
      {
         //if (this.m_FooterList != null && this.m_FooterList.SelectedFooter != null) {
         //   this.m_FooterList.SelectedFooter.LinkInput.StartIndex = this.FooterTextBox.SelectionStart;
         //   this.m_FooterList.SelectedFooter.LinkInput.EndIndex = this.FooterTextBox.SelectionStart + this.FooterTextBox.SelectionLength;
         //   this.m_FooterList.SelectedFooter.StyleInput.StartIndex = this.FooterTextBox.SelectionStart;
         //   this.m_FooterList.SelectedFooter.StyleInput.EndIndex = this.FooterTextBox.SelectionStart + this.FooterTextBox.SelectionLength;
         //}
      }
   }
}
